<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./js/plugins/leaflet/leaflet.css">
    <link rel="stylesheet" href="./js/plugins/leaflet/leaflet-geoman.css">
    <style>
        html,body{margin:0;}
        #map{height:100vh;width: 100%;}
    </style>
    <script src="./js/plugins/leaflet/leaflet.js"></script>
    <script src="./js/plugins/leaflet/leaflet-geoman.min.js"></script>
</head>
<body>
    <div id="map"></div>
    <script>
        var map = L.map('map',{
            //crs: L.CRS.EPSG3857,
            crs: L.CRS.EPSG4326, //WGS 84坐标系，GPS默认坐标系
        }).setView([32,118.791384], 10);
        var url = 'http://t3.tianditu.com/vec_c/wmts?layer=vec&style=default&tilematrixset=c&Service=WMTS&Request=GetTile&Version=1.0.0&Format=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}&tk=ce8b1938caf73130bf9e6d50aaee8dc2'
        L.tileLayer(url, {
            tileSize: 256,
            zoomOffset: 1
        }).addTo(map); 

        map.pm.setLang('zh');
        map.pm.addControls({  
            position: 'topleft',  
            drawCircle: true,  
        }); 

        var polygon = L.polygon([
            [32.00193665786635, 118.72595214634202],
            [32.08428849173447, 118.77813720493577],
            [31.996995539457, 118.8138427818194],
            [32.05299479067595, 118.7127685546875],
            [32.05244578682743, 118.8396606571041]
        ]).addTo(map);

        polygon.pm.enable()

        map.on('pm:create',(e)=>{
            console.log(e)
        });

    </script>
</body>
</html>